﻿using Dora.Orm.SqlSugarCore.UnitOfWork;
using Dora.Services.AdminUser.Entities;
using SqlSugar;
using System.Threading.Tasks;

namespace Dora.Services.AdminUser.Repository
{
    public class DemoRepository : SqlSugarRepository<DemoEntity, int>
    {
        private ISugarUnitOfWork _unitOfWork;
        private SqlSugarClient readSugarClient;  // 读数据
        private SqlSugarClient writeSugarClient; // 写数据

        public DemoRepository(ISugarUnitOfWork unitOfWork) : base(unitOfWork)
        {
            _unitOfWork = unitOfWork;
            readSugarClient = unitOfWork.QueryClient;
            writeSugarClient = unitOfWork.ModifyClient;
        }


        public async Task<DemoEntity> GetDemoById(int id)
        {
            return  await readSugarClient.Queryable<DemoEntity>().FirstAsync();
        }
    }
}
